package com.example.provider;

import com.example.provider.constant.MqConstant;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.common.message.Message;
import org.junit.jupiter.api.Test;

/**
 * @description: TODO
 * @author: uu
 * @date: 2023/12/9 23:13
 * @version: 1.0
 */
public class OneWayRocket {
    @Test
    void oneWay() throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer("oneway-group");
        producer.setNamesrvAddr(MqConstant.NAME_SRV_ADDR);
        producer.start();
        Message message = new Message("onewayTopic", "one way message".getBytes());
        producer.sendOneway(message);
        producer.shutdown();
    }
}
